From: Andrew Cooper Date: Fri, 31 Mar 2017 15:06:07 +0000 (+0100) Subject: x86/hvm: Correct some address space terminology X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~2315 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=df429b9c3f06cb0a04a799e58447548794d1f254;p=xen.git x86/hvm: Correct some address space terminology The function hvm_translate_linear_addr() translates a virtual address to a linear address, not a linear address to a physical address. Correct its name. Both hvm_translate_virtual_addr() and hvmemul_virtual_to_linear() return a linear address, but a parameter name of paddr is easily confused with paddr_t. Rename it to linear, to clearly identify the address space, and for consistency with hvm_virtual_to_linear_addr(). No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Paul Durrant Acked-by: Tim Deegan Reviewed-by: Jan Beulich --- diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index 2d92957c10..4073715225 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -506,7 +506,7 @@ static int hvmemul_virtual_to_linear( unsigned long *reps, enum hvm_access_type access_type, struct hvm_emulate_ctxt *hvmemul_ctxt, - unsigned long *paddr) + unsigned long *linear) { struct segment_register *reg; int okay; @@ -514,7 +514,7 @@ static int hvmemul_virtual_to_linear( if ( seg == x86_seg_none ) { - *paddr = offset; + *linear = offset; return X86EMUL_OKAY; } @@ -549,16 +549,16 @@ static int hvmemul_virtual_to_linear( okay = hvm_virtual_to_linear_addr( seg, reg, offset - (*reps - 1) * bytes_per_rep, *reps * bytes_per_rep, access_type, - hvmemul_ctxt->ctxt.addr_size, paddr); - *paddr += (*reps - 1) * bytes_per_rep; + hvmemul_ctxt->ctxt.addr_size, linear); + *linear += (*reps - 1) * bytes_per_rep; if ( hvmemul_ctxt->ctxt.addr_size != 64 ) - *paddr = (uint32_t)*paddr; + *linear = (uint32_t)*linear; } else { okay = hvm_virtual_to_linear_addr( seg, reg, offset, *reps * bytes_per_rep, access_type, - hvmemul_ctxt->ctxt.addr_size, paddr); + hvmemul_ctxt->ctxt.addr_size, linear); } if ( okay ) diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index d93f2ab5f6..03cb24d830 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -136,13 +136,13 @@ static struct segment_register *hvm_get_seg_reg( return seg_reg; } -static int hvm_translate_linear_addr( +static int hvm_translate_virtual_addr( enum x86_segment seg, unsigned long offset, unsigned int bytes, enum hvm_access_type access_type, struct sh_emulate_ctxt *sh_ctxt, - unsigned long *paddr) + unsigned long *linear) { const struct segment_register *reg; int okay; @@ -152,7 +152,7 @@ static int hvm_translate_linear_addr( return -PTR_ERR(reg); okay = hvm_virtual_to_linear_addr( - seg, reg, offset, bytes, access_type, sh_ctxt->ctxt.addr_size, paddr); + seg, reg, offset, bytes, access_type, sh_ctxt->ctxt.addr_size, linear); if ( !okay ) { @@ -183,7 +183,7 @@ hvm_read(enum x86_segment seg, unsigned long addr; int rc; - rc = hvm_translate_linear_addr( + rc = hvm_translate_virtual_addr( seg, offset, bytes, access_type, sh_ctxt, &addr); if ( rc || !bytes ) return rc; @@ -265,7 +265,7 @@ hvm_emulate_write(enum x86_segment seg, if ( seg == x86_seg_ss ) perfc_incr(shadow_fault_emulate_stack); - rc = hvm_translate_linear_addr( + rc = hvm_translate_virtual_addr( seg, offset, bytes, hvm_access_write, sh_ctxt, &addr); if ( rc || !bytes ) return rc; @@ -291,7 +291,7 @@ hvm_emulate_cmpxchg(enum x86_segment seg, if ( bytes > sizeof(long) ) return X86EMUL_UNHANDLEABLE; - rc = hvm_translate_linear_addr( + rc = hvm_translate_virtual_addr( seg, offset, bytes, hvm_access_write, sh_ctxt, &addr); if ( rc ) return rc; @@ -345,7 +345,7 @@ const struct x86_emulate_ops *shadow_init_emulation( /* Attempt to prefetch whole instruction. */ sh_ctxt->insn_buf_eip = regs->rip; sh_ctxt->insn_buf_bytes = - (!hvm_translate_linear_addr( + (!hvm_translate_virtual_addr( x86_seg_cs, regs->rip, sizeof(sh_ctxt->insn_buf), hvm_access_insn_fetch, sh_ctxt, &addr) && !hvm_fetch_from_guest_linear( @@ -374,7 +374,7 @@ void shadow_continue_emulation(struct sh_emulate_ctxt *sh_ctxt, { /* Prefetch more bytes. */ sh_ctxt->insn_buf_bytes = - (!hvm_translate_linear_addr( + (!hvm_translate_virtual_addr( x86_seg_cs, regs->rip, sizeof(sh_ctxt->insn_buf), hvm_access_insn_fetch, sh_ctxt, &addr) && !hvm_fetch_from_guest_linear(